/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Donnees;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author mizho
 */
@Entity
@Table(name = "acces")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Acces.findAll", query = "SELECT a FROM Acces a"),
    @NamedQuery(name = "Acces.findByIdacces", query = "SELECT a FROM Acces a WHERE a.idacces = :idacces"),
    @NamedQuery(name = "Acces.findByDateacces", query = "SELECT a FROM Acces a WHERE a.dateacces = :dateacces")})
public class Acces implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2147483647)
    @Column(name = "idacces")
    private String idacces;
    @Basic(optional = false)
    @NotNull
    @Column(name = "dateacces")
    @Temporal(TemporalType.DATE)
    private Date dateacces;
    @JoinColumn(name = "utilisateur", referencedColumnName = "idutilisateur")
    @ManyToOne(optional = false)
    private Utilisateur utilisateur;
    @JoinColumn(name = "td", referencedColumnName = "idtd")
    @ManyToOne(optional = false)
    private Td td;

    public Acces() {
    }

    public Acces(String idacces) {
        this.idacces = idacces;
    }

    public Acces(String idacces, Date dateacces) {
        this.idacces = idacces;
        this.dateacces = dateacces;
    }

    public String getIdacces() {
        return idacces;
    }

    public void setIdacces(String idacces) {
        this.idacces = idacces;
    }

    public Date getDateacces() {
        return dateacces;
    }

    public void setDateacces(Date dateacces) {
        this.dateacces = dateacces;
    }

    public Utilisateur getUtilisateur() {
        return utilisateur;
    }

    public void setUtilisateur(Utilisateur utilisateur) {
        this.utilisateur = utilisateur;
    }

    public Td getTd() {
        return td;
    }

    public void setTd(Td td) {
        this.td = td;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idacces != null ? idacces.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Acces)) {
            return false;
        }
        Acces other = (Acces) object;
        if ((this.idacces == null && other.idacces != null) || (this.idacces != null && !this.idacces.equals(other.idacces))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Donnees.Acces[ idacces=" + idacces + " ]";
    }
    
}
